<!doctype html>
<html>
<head>
<?php $this->load->view('admin/common_head'); ?>
</head>
<body>
<div class="wrap jj">
	<div class="nav">
		<div class="return"><a href="<?php echo site_url('admin/user_manage/index'); ?>">返回上一级</a></div>
		<?php
			$tabs = array('edit_base' => '', 'edit_data' => '');
			$tabs[$this->router->fetch_method()] = ' class="current"';
		?>
		<ul class="cc">
			<li<?php echo $tabs['edit_base']; ?>><a href="<?php echo site_url('admin/user_manage/edit_base?uid='.$uid); ?>">编辑</a></li>
			<li<?php echo $tabs['edit_data']; ?>><a href="<?php echo site_url('admin/user_manage/edit_data?uid='.$uid); ?>">数据</a></li>
		</ul>
	</div>
	<form class="J_ajaxForm" action="<?php echo site_url('admin/user_manage/do_edit_base'); ?>" method="post">
		<input type="hidden" value="<?php echo $user['uid']; ?>" name="uid" />
		<div class="h_a">用户信息</div>
		<div class="table_full">
			<table width="100%">
				<col class="th" />
				<col/>
				<thead>
					<tr>
						<th>UID</th>
						<td><?php echo $user['uid']; ?></td>
					</tr>
				</thead>
				<tr>
					<th>用户名</th>
					<td><input name="username" type="text" class="input input_hd length_5" value="<?php echo $user['username']; ?>"></td>
				</tr>
				<tr>
					<th>头像</th>
					<td><div><img id="J_face_img" class="J_avatar" data-type="middle" src="<?php echo base_url(); ?>attachment/user/<?php echo $user['face']; ?>" class="face"></div>
						<a id="J_set_def" href="">[恢复为系统头像]</a></td>
				</tr>
				<tr>
					<th>新密码</th>
					<td><input name="password" type="text" class="input length_5" /></td>
				</tr>
				<tr>
					<th>确认密码</th>
					<td><input name="repassword" type="text" class="input length_5" /></td>
				</tr>
				<tr>
					<th>注册时间</th>
					<td><input name="created" type="text" class="input length_5 J_datetime date" value="<?php echo date('Y-m-d H:i', $user['created']); ?>"></td>
				</tr>
				<tr>
					<th>注册IP</th>
					<td><input name="created_ip" type="text" class="input length_5" value="<?php echo long2ip($user['created_ip']); ?>"></td>
				</tr>
			</table>
		</div>
		<div class="h_a">基本资料</div>
		<div class="table_full">
			<table width="100%">
				<col class="th" />
				<col/>
				<tr>
					<th>真实姓名</th>
					<td><input name="realname" type="text" class="input input_hd length_5" value="<?php echo $user['realname']; ?>" /></td>
				</tr>
				<tr>
					<th>性别</th>
					<td>
						<select name="gender" class="select_5">
							<option value="1" <?php echo set_select('gender', 1, $user['realname'] == 1); ?>>女</option>
							<option value="0" <?php echo set_select('gender', 0, $user['realname'] == 0); ?>>男</option>
						</select>
					</td>
				</tr>
			</table>
		</div>
		<div class="h_a">交易信息</div>
		<div class="table_full">
			<table width="100%">
				<col class="th" />
				<col/>
				<tr>
					<th>支付宝</th>
					<td><input name="alipay" type="text" class="input length_5" value="<?php echo $user['alipay']; ?>" /></td>
				</tr>
				<tr>
					<th>手机号码</th>
					<td><input name="mobile" type="text" class="input length_5" value="<?php echo $user['mobile']; ?>" /></td>
				</tr>
				<tr>
					<th>固定电话</th>
					<td><input name="telphone" type="text" class="input length_5" value="<?php echo $user['realname']; ?>" /></td>
				</tr>
				<tr>
					<th>地址</th>
					<td><input name="address" type="text" class="input length_5" value="<?php echo $user['address']; ?>" /></td>
				</tr>
			</table>
		</div>
		<div class="h_a">联系信息</div>
		<div class="table_full">
			<table width="100%">
				<col class="th" />
				<col/>
				<tr>
					<th>电子邮箱</th>
					<td><input name="email" type="email" class="input length_5" value="<?php echo $user['email']; ?>" /></td>
				</tr>
				<tr>
					<th>QQ</th>
					<td><input name="qq" type="text" class="input length_5" value="<?php echo $user['qq']; ?>" /></td>
				</tr>
			</table>
		</div>
		<div class="btn_wrap">
			<div class="btn_wrap_pd">
				<button type="submit" class="btn btn_submit">提交</button>
			</div>
		</div>
	</form>
</div>
<?php $this->load->view('admin/common_footer'); ?>
<script>
Wind.use('region', function(){
	$('a.J_region_change').region();

	//恢复默认头像
	$('#J_set_def').on('click', function(e){
		e.preventDefault();
		var $this = $(this);
		$.post(this.href, function(data){
			if(data.state == 'success') {
				$('#J_face_img').attr('src', '<?php echo base_url(); ?>res/images/face/face_middle.jpg');
				$this.hide();
			}else{
				//common.js
				resultTip({
					error : true,
					msg : data.message[0]
				});
			}
		}, 'json');
	});
});
</script>
</body>
</html>